package pers.xiaojun.boot.common.constants;

import pers.xiaojun.boot.common.pojo.BusinessCode;

/**
 * 全局业务代码常量
 *
 * @author xiaojun
 * @since 2025-10-02
 */
public interface GlobalBusinessCodeConstants {

    BusinessCode SUCCESS = BusinessCode.of(0, "成功");

    // ========== 客户端错误段 ==========

    BusinessCode BAD_REQUEST = BusinessCode.of(400, "请求参数不正确");
    BusinessCode UNAUTHORIZED = BusinessCode.of(401, "账号未登录");
    BusinessCode FORBIDDEN = BusinessCode.of(403, "没有该操作权限");
    BusinessCode NOT_FOUND = BusinessCode.of(404, "请求未找到");
    BusinessCode METHOD_NOT_ALLOWED = BusinessCode.of(405, "请求方法不正确");
    BusinessCode LOCKED = BusinessCode.of(423, "请求失败，请稍后重试"); // 并发请求，不允许
    BusinessCode TOO_MANY_REQUESTS = BusinessCode.of(429, "请求过于频繁，请稍后重试");

    // ========== 服务端错误段 ==========

    BusinessCode INTERNAL_SERVER_ERROR = BusinessCode.of(500, "系统异常");
    BusinessCode NOT_IMPLEMENTED = BusinessCode.of(501, "功能未实现/未开启");
    BusinessCode ERROR_CONFIGURATION = BusinessCode.of(502, "错误的配置项");

    // ========== 自定义错误段 ==========

    BusinessCode REPEATED_REQUESTS = BusinessCode.of(900, "重复请求，请稍后重试"); // 重复请求
    BusinessCode DEMO_DENY = BusinessCode.of(901, "演示模式，禁止写操作");

    BusinessCode UNKNOWN = BusinessCode.of(999, "未知错误");

}
